﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
//using LTP.Accounts.Bus;
namespace xxxy.Web.activityInfo
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtaPName.Text.Trim().Length==0)
			{
				strErr+="照片名称不能为空！\\n";	
			}
			if(!PageValidate.IsNumber(txtaType.Text))
			{
				strErr+="活动类型格式错误！\\n";	
			}
			if(!PageValidate.IsDateTime(txtatime.Text))
			{
				strErr+="活动日期格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtaUpload.Text))
			{
				strErr+="上传人格式错误！\\n";	
			}
			if(!PageValidate.IsDateTime(txtaUploadTmie.Text))
			{
				strErr+="上传时间格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtaStation.Text))
			{
				strErr+="状态格式错误！\\n";	
			}
			if(this.txtaPhoto1.Text.Trim().Length==0)
			{
				strErr+="活动照片1不能为空！\\n";	
			}
			if(this.txtaPhoto2.Text.Trim().Length==0)
			{
				strErr+="活动照片2不能为空！\\n";	
			}
			if(this.txtrRemarks.Text.Trim().Length==0)
			{
				strErr+="备注不能为空！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string aPName=this.txtaPName.Text;
			int aType=int.Parse(this.txtaType.Text);
			DateTime atime=DateTime.Parse(this.txtatime.Text);
			int aUpload=int.Parse(this.txtaUpload.Text);
			DateTime aUploadTmie=DateTime.Parse(this.txtaUploadTmie.Text);
			int aStation=int.Parse(this.txtaStation.Text);
			string aPhoto1=this.txtaPhoto1.Text;
			string aPhoto2=this.txtaPhoto2.Text;
			string rRemarks=this.txtrRemarks.Text;

			xxxy.Model.activityInfo model=new xxxy.Model.activityInfo();
			model.aPName=aPName;
			model.aType=aType;
			model.atime=atime;
			model.aUpload=aUpload;
			model.aUploadTmie=aUploadTmie;
			model.aStation=aStation;
			model.aPhoto1=aPhoto1;
			model.aPhoto2=aPhoto2;
			model.rRemarks=rRemarks;

			xxxy.BLL.activityInfo bll=new xxxy.BLL.activityInfo();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
